package javase.Reflect;

import java.io.FileReader;
import java.io.InputStream;
import java.util.Properties;

public class IoPropertiesTest {
    public static void main(String[] args) throws Exception{

        /* 获得绝对路径path
        String path = Thread.currentThread().getContextClassLoader()
                .getResource("classinfo2.properties").getPath();

        FileReader reader = new FileReader(path);
         */

        // 直接以流的形式返回
        InputStream reader = Thread.currentThread().getContextClassLoader()
                .getResourceAsStream("classinfo2.properties");


        Properties pro = new Properties();

        pro.load(reader);
        reader.close();

        String str = pro.getProperty("className");
        System.out.println(str);

    }
}
